package com.wish.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.dto.RoomReservationDto;
import com.wish.entity.RoomReservation;
import com.wish.entity.SysRegion;
import com.wish.service.IRoomReservationService;
import com.wish.vo.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 预约房源表 前端控制器
 * </p>
 *
 * @author 五组
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/wish.fangyuan/room-reservation")
public class RoomReservationController {
    @Resource
    private IRoomReservationService roomReservationService;

    @RequestMapping("selects")
    public ResultEntity selects(RoomReservationDto roomReservationDto){
        PageHelper.startPage(roomReservationDto.getPageNum(),roomReservationDto.getPageSize());
        List<RoomReservation> list = roomReservationService.selects(roomReservationDto);

        PageInfo<RoomReservation> info = new PageInfo<>(list);
        return ResultEntity.ok("200","查询成功",info);
    }


    @RequestMapping("update")
    public boolean update(Integer status,String[] ids){

        try {
            roomReservationService.update(status,ids);
            return true;
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }


}
